<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Password Change</title>
<link href="/tros/menuMain.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">

function passValidation()
{
var exPass = document.passform.expass;
var newPass = document.passform.newpass;
var confPass = document.passform.confpass;

if(validPassWrd(exPass,5,12)){
if(validPassWrd(newPass,5,12)){
if(validPassWrd(confPass,5,12)){
if(passMatch(newPass,confPass)){
	if(update()){
	document.forms[0].submit();
	return true;
	}
}
}
}
}
return false;
}

function passMatch(newPass,confPass)
{	
if(newPass.value != confPass.value)
{
alert('New and Confirm Password doesnt Match'); 
return false;	
}
else{	
return true;
}
}

function validPassWrd(passWrd,st,fin)
{
var passLen = passWrd.value.length;
if(passLen == 0 || passLen < st || passLen > fin )
{
alert('Password must not be Empty & must be between 5 to 12 chars'); 
return false;
}else
{
return true;
}
}

</script>
</head>
<body>
<table width=100% bordercolor="#C6D4E1" bgcolor="#C6D4E1">
<tr><th scope="col"><div align="center"><h1 align="center"><font face="Times New Roman">Tros - Online Banking System </font></h1></div></th></tr>
</table>
<div id="overall" align="center">
<div id="dropdwn" align="center">
<ul>
<li><a href='custHome.jsp?value=<%=session.getAttribute( "currentID" )%>'>Home</a>
</li>
</ul>
<ul>
<li><a href='accountInfo.jsp?value=<%=session.getAttribute( "currentID" )%>'>Account</a>
<ul>
<li><a href='viewBalance.jsp?value=<%=session.getAttribute( "currentID" )%>'>View Balance</a></li>
<li><a href='viewTransaction.jsp?value=<%=session.getAttribute( "currentID" )%>'>View Transactions</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='transferMain.jsp?value=<%=session.getAttribute( "currentID" )%>'>Transfer</a>
<ul>
<li><a href='depositMain.jsp?value=<%=session.getAttribute( "currentID" )%>'>Deposit</a></li>
<li><a href='withdrawal.jsp?value=<%=session.getAttribute( "currentID" )%>'>Withdraw</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='creditCard.jsp?value=<%=session.getAttribute( "currentID" )%>'>Credit Card</a>
</li>
</ul>
<ul>
<li><a href='paybills.jsp?value=<%=session.getAttribute( "currentID" )%>'>Pay Bills</a>
</li>
</ul>
<ul>
<li><a href='investMain.jsp?value=<%=session.getAttribute( "currentID" )%>'>Investments</a>
<ul>
<li><a href='viewShareInv.jsp?value=<%=session.getAttribute( "currentID" )%>'>Current Shares</a></li>
<li><a href='viewFdInv.jsp?value=<%=session.getAttribute( "currentID" )%>'>Current Fixed Deposit</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='updatePer.jsp?value=<%=session.getAttribute( "currentID" )%>'>Update Personal Info</a>
<ul>
<li><a href='changePass.jsp?value=<%=session.getAttribute( "currentID" )%>'>Change Password</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='logout.jsp'>Log Out</a></li>
</ul>
<br class="flow" />
</div>
</div>
&nbsp;
&nbsp;
<fieldset>
<legend><b> Password </b></legend>
<h3 align=center> Password Changer </h3>
<p align=center>Please enter the old password and new password to change </p>
<form name="passform" action="PassChangeCheck" onSubmit="return passValidation();" method="post">
<table width=50% align=center cellpadding=5 cellspacing=0 bgcolor="#D5FFD5">
<tr><td>&nbsp;</td><tr>
<tr>
<td height="25"><div align="right">Existing Password </div></td>
<td><input type="password" name="expass" value="" maxlength=12 /></td>
</tr>
<tr>
<td height="25"><div align="right">New Password</div></td>
<td><input type="password" name="newpass" value="" maxlength=12 /></td>
</tr>
<tr>
<tr>
<td height="25"><div align="right">Confirm Password</div></td>
<td><input type="password" name="confpass" value="" maxlength=12 /></td>
</tr>
<tr>
<td colspan=2 align=center bgcolor="#D5FFD5"><button type="submit"><u>C</u>hange</button>&nbsp;<button type="reset"><u>R</u>eset</button></td> 
</tr>
<tr><td>&nbsp;</td></tr>
</table>
</form>
</fieldset>
</body>
</html>